package fr.pentalog.ctc.util;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;

/**
 * @author Danut Chindris
 * @since December 5, 2013
 */

public class CtcInterceptor extends HandlerInterceptorAdapter {

	public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
		request.getSession().setAttribute(WebAppConstants.WEBAPP_IP, request.getLocalAddr());
		request.getSession().setAttribute(WebAppConstants.WEBAPP_CONTEXT, request.getContextPath());
		return true;
	}
}
